home *** CD-ROM | disk | FTP | other *** search
/ Java 1996 August / Java - Summer 1996.iso / kaffe-0.2 / kaffe / file.h < prev    next >
C/C++ Source or Header  |  1996-02-12  |  838b  |  33 lines

  1. /*
  2.  * file.h
  3.  * File support routines.
  4.  *
  5.  * Copyright (c) 1996 Systems Architecture Research Centre,
  6.  *           City University, London, UK.
  7.  *
  8.  * See the file "license.terms" for information on usage and redistribution
  9.  * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
  10.  *
  11.  * Written by Tim Wilkinson <tim@sarc.city.ac.uk>, February 1996.
  12.  */
  13.  
  14. #ifndef __file_h
  15. #define __file_h
  16.  
  17. #include "gtypes.h"
  18.  
  19. typedef struct {
  20.     unsigned char*    base;
  21.     unsigned char*    buf;
  22.     int        size;
  23. } classFile;
  24.  
  25. #define    readu1(c,f)    (*(c) = f->buf[0], f->buf += 1)
  26. #define    readu2(c,f)    (*(c) = (f->buf[0] << 8) | f->buf[1], f->buf += 2)
  27. #define    readu4(c,f)    (*(c) = (f->buf[0] << 24)|(f->buf[1] << 16)|\
  28.                 (f->buf[2] << 8)|f->buf[3], f->buf += 4)
  29. #define    readm(b,l,s,f)    (memcpy(b, f->buf, (l)*(s)), f->buf += (l)*(s))
  30. #define    seekm(f,l)    (f->buf += (l))
  31.  
  32. #endif
  33.